//
//  PublicTableViewCell.m
//  AlarmClock
//
//  Created by apple on 16/9/30.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "PublicTableViewCell.h"
#import "SDAutoLayout.h"
@implementation PublicTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initializeAperance];
    }
    return self;
}

- (void)initializeAperance {
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.selectImage];
    
    self.titleLabel.sd_layout
    .leftSpaceToView(self.contentView,20)
    .topSpaceToView(self.contentView,20)
    .widthIs(150)
    .heightIs(30);
    
    self.selectImage.sd_layout
    .rightSpaceToView(self.contentView,20)
    .topSpaceToView(self.contentView,20)
    .widthIs(30)
    .heightIs(30);
}


#pragma mark - getter
- (UILabel *)titleLabel {
    if (_titleLabel) {
        return _titleLabel;
    }
    _titleLabel = [[UILabel alloc]init];
    return _titleLabel;
}

- (UIImageView *)selectImage {
    if (_selectImage) {
        return _selectImage;
    }
    _selectImage = [[UIImageView alloc]init];
    return _selectImage;
}

-(void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:selected animated:animated];
    if (!selected) {
        _selectImage.image = [UIImage imageNamed:@"单选_未选中"];
    }else{
        _selectImage.image = [UIImage imageNamed:@"单选_选中"];
    }
}

-(void)setSelected:(BOOL)selected{
    if (!selected) {
        _selectImage.image = [UIImage imageNamed:@"单选_未选中"];
    }else{
       _selectImage.image = [UIImage imageNamed:@"单选_选中"];
    }
    [super setSelected:selected];
}

@end
